<?php

namespace api\controller;

use common\controller\VerifyController;
use common\service\ProjectTaskProgressService;
use think\Request;

class ProjectTaskProgressController extends VerifyController
{
    /**
     * @var ProjectTaskProgressService
     */
    private $projectTaskProgressService;

    public function __construct()
    {
        parent::__construct();
        $this->projectTaskProgressService = ProjectTaskProgressService::getInstance();
    }

    /**
     * 查询需求变更情况
     * @param Request $request
     * @return \think\Response
     */
    public function getDemandChangeList(Request $request)
    {
        $param = $request->param();
        $filter = $param['param']['filter'];
        $page = $param['param']['page'] ?? [1, C("database.database_max_select_rows")];
        $resData = $this->projectTaskProgressService->getDemandChangeList($filter, $page);
        return json(success_response('', $resData));
    }

    /**
     * 获取环节任务进度列表
     * @param \think\Request $request
     * @return \think\Response
     * @throws \Exception
     */
    public function getStepCategoryTaskProgressList(Request $request)
    {
        $param = $request->param()['param'];
        $res = $this->projectTaskProgressService->getStepCategoryTaskProgressList($param, $request->getTenantId());
        return json(success_response("", $res));
    }

    /**
     * 获取任务进度详情列表
     * @throws \Exception
     */
    public function getTaskProgressInfoList(Request $request)
    {
        $param = $request->param()['param'];
        $res = $this->projectTaskProgressService->getTaskProgressInfoList($param);
        return json(success_response("", $res));
    }

    /**
     * 获取标准会议任务列表
     * @param \think\Request $request
     * @return \think\Response
     */
    public function getStandardMeetingList(Request $request)
    {
        $param = $request->param()['param'];
        $res = $this->projectTaskProgressService->getStandardMeetingList($param);
        return json(success_response("", $res));
    }
}